<%@ page contentType="text/xml; charset=UTF-8" language="java" import="java.util.*" errorPage="/error.jsp" %>
<%@ page import="com.beans.log.*"%>
<%@ page import="com.business.log.*"%>
<%@ page import="com.beans.user.*"%>
<%@ page import="com.business.user.*" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
  String logtypeId=request.getPathInfo();	
    StringTokenizer t=new StringTokenizer(logtypeId,"/");
    String username=t.nextToken();
	LogListBus llb=new LogListBus();
	UserListBus uis=new UserListBus();
	UserInfo ui=uis.getUserInfo(username);
	if(t.hasMoreTokens()) {
        logtypeId=t.nextToken();
    	logtypeId=logtypeId.replace(".html","");		
    int id=Integer.parseInt(logtypeId);
	
	LogTypeBus ltb=new LogTypeBus();
	LogType lt=ltb.getLogTypeById(id);
%>
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
<channel><title><![CDATA[<%=ui.getBlogName()%>的博客--<%=lt.getLogtypeName()%>]]></title>
<link><![CDATA[www.sgwood.com.cn/show/<%=username%>/<%=lt.getLogtypeId()%>.html]]></link>
<description><![CDATA[<%=ui.getBlogMemo()%>]]></description>
<generator>generator</generator>
<language>zh-CN</language>
<copyright><![CDATA[SGblog V1.0]]></copyright>
<%	

List list=llb.getAllLogByTypeID(id);

	for(int i=0;i<list.size();i++)
	{
	LogInfo li=(LogInfo)list.get(i);
%>
<item>
<title><![CDATA[<%=li.getLogTitle()%>]]></title>
<link><![CDATA[<%=basePath%>log/temp/<%=li.getLogNo()%>.html]]></link>
<author><![CDATA[<%=li.getLogAuthor()%>]]></author> 
<pubDate><%=li.getLogPostTime()%></pubDate>
<guid><%=li.getLogNo()%></guid>
<category><%=li.getLogtypeId()%></category>
<description><![CDATA[<%=li.getLogContent()%>]]></description>
</item>

<%
	
  }
	}else {
%>
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
<channel><title><![CDATA[<%=ui.getBlogName()%>的博客]]></title>
<link><![CDATA[<%=basePath%>/blog/<%=username%>]]></link>
<description><![CDATA[<%=ui.getBlogMemo()%>]]></description>
<generator>generator</generator>
<language>zh-CN</language>
<copyright><![CDATA[SGblog V1.0]]></copyright>
<%
List list=llb.getAllLogByShow(username);

	for(int i=0;i<list.size();i++)
	{
	LogInfo li=(LogInfo)list.get(i);
%>
<item>
<title><![CDATA[<%=li.getLogTitle()%>]]></title>
<link><![CDATA[<%=basePath%>log/temp/<%=li.getLogNo()%>.html]]></link>
<author><![CDATA[<%=li.getLogAuthor()%>]]></author> 
<pubDate><%=li.getLogPostTime()%></pubDate>
<guid><%=li.getLogNo()%></guid>
<category><![CDATA[<%=((new LogTypeBus()).getLogTypeById(li.getLogtypeId())).getLogtypeName()%>]]></category>
<description><![CDATA[<%=li.getLogContent()%>]]></description>
</item>
<%		}
	}
%>
</channel>
</rss>